package com.itheima.search.mq;


import com.hmall.client.Feignclient;
import com.itheima.search.constatnts.MqConstants;
import com.itheima.search.service.SearService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HotelListener {

    @Autowired
    private SearService service;

    /**
     * 监听酒店新增或修改的业务
     *
     *  id 酒店id
     */
    @RabbitListener(queues = MqConstants.HOTEL_INSERT_QUEUE)
    public void listenHotelInsertOrUpdate(long id) {
        service.itemStatusUp(id);
    }

    /**
     * 监听酒店删除业务
     * id 酒店id
     */
    @RabbitListener(queues = MqConstants.HOTEL_DELETE_QUEUE)
    public void listenHotelDelete(long id) {
        service.itemStatusDow(id);
    }
}
